package org.wuyong.rtc.signalling.web;

import org.springframework.messaging.handler.annotation.MessageMapping;
import org.springframework.messaging.handler.annotation.SendTo;
import org.springframework.web.bind.annotation.RestController;
import org.wuyong.rtc.signalling.RTCSessionDescription;
import org.wuyong.rtc.signalling.RequestMessage;
import org.wuyong.rtc.signalling.ResponseMessage;

/**
 * @author He Peng
 * @create 2017-12-31 0:08
 * @update 2017-12-31 0:08
 * @updatedesc : 更新说明
 * @see
 */

@RestController
public class WebSocketDemoController {

    @MessageMapping("/welcome")
    @SendTo("/topic/getResponse")
    public ResponseMessage say(RequestMessage message) {
        System.out.println("==========================  " + message.getName());
        return new ResponseMessage("welcome," + message.getName() + " !");
    }

    @MessageMapping("/video-chat")
    @SendTo("/topic/signalling")
    public RTCSessionDescription signalling(RTCSessionDescription rtcDesc) {
        System.out.println("==========================  " + rtcDesc);
        RTCSessionDescription rtcSessionDescription = new RTCSessionDescription();
        return rtcDesc;
    }
}
